package com.mjl.shops.base;

import android.app.Application;
import android.graphics.Typeface;

import com.mjl.shops.utils.SharedUtils;

import java.text.DecimalFormat;

import cn.bmob.v3.Bmob;

public class ShopApp extends Application {

    //double保留两位小数
    public static DecimalFormat decimalFormat = new DecimalFormat("0.00");

    public static Typeface mIconFont;

    private static ShopApp mInstance;

    //偏好设置
    private static SharedUtils sharedUtils;

    @Override
    public void onCreate() {
        super.onCreate();
        if (mIconFont == null){
            mIconFont = Typeface.createFromAsset(getAssets(), "iconfont.ttf");
        }

        if (mInstance == null){
            mInstance = this;
        }

        //初始化bmob
        Bmob.initialize(this, "80aadf32625560aa3df6dcb9df7776e0");

        sharedUtils = SharedUtils.getInstance();
    }

    public static ShopApp getInstance(){
        return mInstance;
    }

    public static SharedUtils getSharedUtils(){
        if (sharedUtils == null){
            sharedUtils = SharedUtils.getInstance();
        }
        return sharedUtils;
    }
}
